-
Notifications
You must be signed in to change notification settings - Fork 47.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rudimentary test renderer #6944
Conversation
Nothing exposed and we can iterate before we support anything so go go go. |
* | ||
* @param {ReactComponent} componentInstance The instance to mount. | ||
* @param {number} rootID ID of the root node. | ||
* @param {number} containerTag container element to mount into. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra jsdoc blocks (rootId
and containerTag
)
cc @cpojer |
Awesome. We'll hook this up with snapshot testing over the next two weeks and make a Jest release in about 1.5 weeks from now and also post a nice blog post about snapshot testing. This is gonna be great for react-dom, react-native and any other render target testing. |
Also cc @thejameskyle – @spicyj is adding a field to typecheck whether this is a test render instance, in pretty-format we can then do: // Jest:
expect(rendered).toMatchSnapshot();
// pretty-format:
if (value.$$typeof == 'react.test-render') {
formatAsJSXLike(value.toJSON);
} this is gonna be great. |
Let's hold off on any public announcement until we solidify the APIs and try it at Facebook some. |
Yep, that is the plan but @gaearon tweeted about it already! To everyone: please give us two weeks until we can better explain what this is, to show how it works and so we can explain which API guarantees we are providing in React and in Jest. |
Have I understood correctly that this cannot be used together with the DOM renderer, because of the injection? i.e. once your node process has Or am I missing something? (+1 on having a |
(cherry picked from commit 50982ce)
(cherry picked from commit 50982ce)
No description provided.